import {
	request,
} from '@/api/request';
const apiList = [{
		// 验证码登录
		name: 'mobilelogin',
		url: '/api/user/mobilelogin'
	},
	{
		// 验证
		name: 'send',
		url: '/api/sms/send'
	},
	{
		// /api/user/index
		name: 'userindex',
		method: 'GET',
		url: '/api/user/index',
	},
	// /api/user/login
	{
		name: 'login',
		url: '/api/user/login',
	},
	// /api/user/register
	{
		name: 'register',
		url: '/api/user/register',
	},
	// /api/user/defaultAddress
	{
		name: 'defaultAddress',
		url: '/api/user/defaultAddress',
		method:'GET'
	},
	{
		// insertAddress
		name: 'insertAddress',
		url: '/api/user/insertAddress',
	},
	{
		// /api/user/ourAddress
		name: 'ourAddress',
		url: '/api/user/ourAddress',
		method:'GET'
	},
	{
		// /api/user/deleteAddress
		name: 'deleteAddress',
		url: '/api/user/deleteAddress'
	},
	// /api/index/myValid
	{
		name: 'myValid',
		url: '/api/index/myValid',
		method:'GET'
	},
	// /api/index/validCreate
	{
		name: 'validCreate',
		url: '/api/index/validCreate',
	},
	// /api/user/myTx
	{
		name: 'myTx',
		url: '/api/user/myTx',
		method:'GET'
	},
	// /api/user/myWallet
	{
		name: 'myWallet',
		url: '/api/user/myWallet',
		method:'GET'
	},
	// /api/order/chargeMoney?price
	{
		name: 'chargeMoney',
		url: '/api/order/chargeMoney'
	},
	// /api/user/profile
	{
		name: 'profile',
		url: '/api/user/profile'
	},
	// /api/user/resetpwd
	{
		name: 'resetpwd',
		url: '/api/user/resetpwd'
	},
]


module.exports = apiList.reduce((mode, params) => {
	mode[params.name] = (data, token) => request({
		url: params.url,
		method: params.method || 'POST',
		data,
		token
	})
	return mode
}, {})